package com.im.client.lib;

public class ImClientLib {
	
	private MessageClient messageClient;
	private String keepLiveTime = "60000";

	static {

		System.loadLibrary("imclient");

	}

	public ImClientLib(MessageClient messageClient) {
		this.messageClient = messageClient;
	}


	public native String test();
	
	
	public native byte[] getHtml(String host,int port);
	
	
	public void callBack(String str){
	}
	
	public void regmsg(byte[] msg){
	}
	
	public void receiveMessage(String from,byte[] msg){
		this.messageClient.receiveMessage(from, msg);
	}
	
	
	
	
	
	private String username;
	
	private String password;
	
	private String host;
	
	private int port;
	
	
	public void setUserInfo(String username,String password){
		this.username = username;
		this.password = password;
	}
	public void setNetInfo(String host,int port){
		this.host = host;
		this.port = port;
	}
	
	public void setKeepLive(long time){
		this.keepLiveTime  =String.valueOf(time);
	}
	
	public  boolean start(){
		return start( username, password, host, port,this.keepLiveTime);
	}
	
	public native  boolean start(String username,String password,String host,int port,String time);
	
	public native  boolean sendMessage(String to,String message);
	
	public   boolean track(String messageId,String result){
		return false;
	}
	
	
	public native  boolean close();
	
	public   void headleInfo(String info){
		this.messageClient.headleInfo(info);
	}
	
	
	

}
